import request from '../utils/axios';


export function getTaskList(data) {
	return request({
		url: '/inspectionMission/getInspectionMissionList',
		method: 'get',
	    params:data
	});
}

export function getTaskInspection(data) {
	return request({
		url: '/inspectionMissionItem/getInspectionMissionItem',
		method: 'get',
	    params:data
	});
}

export function getUndealedTask(data) {
	return request({
		url: '/inspectionMission/regenerateMission',
		method: 'get',
	    params:data
	});
}
export function getTaskResult(data) {
	return request({
		url: '/inspectionMissionItem/getInspectionMissionResult',
		method: 'get',
	    params:data
	});
}
export function addOrUpdateTask(data, forEdit) {
    if ( forEdit ) {
        return request({
            url: '/inspectionMission/editInspectionMission',
            method: 'put',
            data
        });
    } else {
        return request({
            url: '/inspectionMission/addInspectionMission',
            method: 'post',
            data
        });
    }
}

export function delTask(data) {
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionMission/delInspectionMission',
		method: 'delete',
		data:formData
	});
}
